<template>
  <transition name="fade">
    <div v-show="visible" class="header-detail">
      <div class="detail-wrapper clear-fix">
        <div class="detail-main">
          <div class="name">{{seller.name}}</div>
          <div class="star-wrapper">
            <star :size="48" :score="seller.score"></star>
          </div>
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>
          <ul v-if="seller.supports" class="supports">
            <li
              class="support-item"
              v-for="(item, index) of seller.supports"
              :key="item.id"
            >
            <support-ico :size=2 :type="seller.supports[index].type" ></support-ico>
            <span class="text">{{seller.supports[index].description}}</span>
            </li>
          </ul>
          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>
          <div class="bulletin">
            <div class="content">{{seller.bulletin}}</div>
          </div>
        </div>
      </div>
      <div class="detail-close" @click="handleClose">
        <i class="icon-close"></i>
      </div>
    </div>
  </transition>
</template>

<script>
import SupportIco from 'components/support-ico/support-ico'
import Star from 'components/star/star'

export default {
  name: 'HeaderDetail',
  components: {
    SupportIco,
    Star
  },
  data () {
    return {
      visible: false
    }
  },
  props: {
    seller: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  methods: {
    show () {
      this.visible = true
    },
    handleClose () {
      this.visible = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import '~common/stylus/mixin'
  @import "~common/stylus/variable"

  .header-detail
    position: fixed
    top: 0
    left: 0
    z-index: 100
    width: 100%
    height: 100%
    overflow: auto
    color: $color-white
    backdrop-filter: blur(10px)
    opacity: 1
    background: $color-background-s
    &.fade-enter, &.fade-leave-to
      opacity: 0
      background: $color-background
    &.fade-enter-active, &.fade-leave-active
      transition: all .5s
  .detail-wrapper
    display: inline-block
    width: 100%
    min-height: 100%
    .detail-main
      margin-top: 64px
      padding-bottom: 64px
      .name
        line-height: 16px
        text-align: center
        font-size: $fontsize-large
        font-weight: 700
      .star-wrapper
        margin-top: 18px
        padding: 2px 0
        text-align: center
      .title
        display: flex
        align-items: center
        width: 80%
        margin: 28px auto 24px auto
        .line
          flex: 1
          border-bottom: 1px solid rgba(255, 255, 255, 0.2)
        .text
          padding: 0 12px
          font-weight: 700
          font-size: $fontsize-medium
      .supports
        width: 80%
        margin: 0 auto
        .support-item
          display: flex
          align-items: center
          padding: 0 12px
          margin-bottom: 12px
          &:last-child
            margin-bottom: 0
          .text
            line-height: 16px
            font-size: $fontsize-small
            margin-left: 6px
      .bulletin
        width: 80%
        margin: 0 auto
        .content
          padding: 0 12px
          line-height: 24px
          font-size: $fontsize-small
          text-align: justify
  .detail-close
    position: relative
    width: 30px
    height: 30px
    margin: -64px auto 0 auto
    font-size: $fontsize-large-xxxx
</style>
